from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy import create_engine

DB_CONNECT_STRING = 'mysql+mysqlconnector://root:12345678@localhost:3306/test?charset=utf8'

engine = create_engine(DB_CONNECT_STRING, echo=True)

Base = declarative_base()


class User(Base):
    __tablename__ = 'users2'
    id = Column(Integer, primary_key=True)
    name = Column(String(30))
    fullname = Column(String(30))
    password = Column(String(50))

    def __init__(self, name, fullname, password):
        self.name = name
        self.fullname = fullname
        self.password = password

    def __repr(self):
        return "<User('%s','%s','%s')>" % (self.name, self.fullname, self.password)


Base.metadata.create_all(engine)